package com.beijiteshop.libcommon.base.fragment

/**
 * @desc 懒加载基类Fragment
 */
abstract class BaseLazyFragment(layoutId: Int) : BaseFragment(layoutId){

    private var mIsLoaded = false

    override fun onResume() {
        super.onResume()
        if (!mIsLoaded && !isHidden){
            onLazyLoad()
            mIsLoaded = true
        }
    }

    override fun onDestroyView() {
        super.onDestroyView()
        mIsLoaded = false;
    }

    /**
     * 在页面第一次可见时加载数据
     */
    abstract fun onLazyLoad()
}